package cn.afactory.tygz.controller;

import android.content.Context;
import android.os.Handler;

/**
 * Created by Kenneth on 15/9/8.
 */
public abstract class BaseLogicController {
    protected Handler mUiHandler;
    protected Context mContext;

    public BaseLogicController(Context context, Handler handler) {
        mUiHandler = handler;
        mContext = context;
    }

    protected void sendMessage(int what, Object obj) {
        sendMessage(what, 0, 0, obj);
    }

    protected void sendMessage(int what) {
        sendMessage(what, null);
    }

    protected void sendMessage(int what, int arg1, int arg2) {
        sendMessage(what, arg1, arg2, null);
    }

    protected void sendMessage(int what, int arg1, int arg2, Object obj) {
        if (mUiHandler != null) {
            mUiHandler.obtainMessage(what, arg1, arg2, obj).sendToTarget();
        }
    }
}
